Skip to content

Commit 902ac15

Browse files
authored
Change endpoint and js to return hierarchical list (#6624)
1 parent 5dae345 commit 902ac15

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

kitsune/products/views.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from kitsune.wiki.facets import documents_for, topics_for
1313
from kitsune.wiki.models import Document, Revision
1414
from kitsune.wiki.utils import build_topics_data, get_featured_articles
15+
from kitsune.flagit.views import get_hierarchical_topics
1516

1617

1718
@check_simple_wiki_locale
@@ -43,9 +44,7 @@ def product_landing(request: HttpRequest, slug: str) -> HttpResponse:
4344

4445
if request.headers.get("x-requested-with") == "XMLHttpRequest":
4546
# Return a list of topics/subtopics for the product
46-
topic_list = list()
47-
for t in Topic.active.filter(products=product, visible=True):
48-
topic_list.append({"id": t.id, "title": t.title})
47+
topic_list = get_hierarchical_topics(product)
4948
return HttpResponse(json.dumps({"topics": topic_list}), content_type="application/json")
5049

5150
if slug == "firefox":

kitsune/sumo/static/sumo/js/questions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function initEditDetails() {
148148
var $opt = $('<option />');
149149

150150
$opt.attr('value', topic.id);
151-
$opt.text(topic.title);
151+
$opt.html(topic.title);
152152

153153
$('#details-topic').append($opt);
154154
}

0 commit comments

Comments
 (0)